<?php 
/*********************************************************
This file provides a list of available bank signed MO
that customer can copy to try to cheat
*********************************************************/

/*********************************************************
includes
*********************************************************/
require_once 'config.inc';
require_once '_common.inc';
require_once '_customer.inc';
require_once '_db.inc';
require_once '_rsa.inc';
require_once '_ui.inc';

/*********************************************************
set the correct time zone to eliminate warnings in debug
date_default_timezone_set('America/New_York');

$script_tz = date_default_timezone_get();

if (strcmp($script_tz, ini_get('date.timezone'))){
    echo 'Script timezone differs from ini-set timezone.';
}
*********************************************************/

/*********************************************************
connect to db
*********************************************************/
$customer_conn = db_connect(CUSTOMER_DB_USER, CUSTOMER_DB_PASSWORD);

/*********************************************************
get available mo batches
*********************************************************/
$sql = "select * from mo_detail_customer 
		where bank_sig is not null and spent = 0";

$q_results = db_do_query($customer_conn, $sql);

/*********************************************************
close db connection
*********************************************************/
oci_close($customer_conn);

?>
<HTML>

<HEAD>
	<title>Select Signed Money Order to Copy</title>
</HEAD>

<?php
ui_print_header('Customer - Select Signed Money Order to Copy 3O_1');
echo <<<END
<FORM action="3O_2_CustomerCopyRes.php" method="post">
	<TABLE border="0">
	<tr><td width="190">Select Signed Money Order to Copy</td>
	<td width="20">:</td>
	<td>
END;

$mobatch = "test";
echo "<select name=\"$mobatch\">\n";
echo "<option value=\"NULL\">Money Orders Available to Copy</option>\n";

foreach($q_results as $qr) {
	$mou = $qr['UNIQUENESS_STRING'];
	$moc = "Uniqueness String: " . $qr['UNIQUENESS_STRING'] . 
		", Value: " . $qr['VAL'];
	echo "<option value=\"$mou\">$moc</option>\n";
}

echo "</select>";

echo <<<END
	<TR>
		<TD colspan="2" align="center">
			<input type="submit" value="Copy This Money Order">
		</TD>
		</TR>
	</TABLE>
</FORM>
END;

ui_print_footer(date('Y-m-d H:i:s'));
?>